import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MartyrsVO, MartyrsForm, MartyrsQuery } from '@/api/cemetery/martyrs/types';

/**
 * 查询名人烈士列表
 * @param query
 * @returns {*}
 */

export const listMartyrs = (query?: MartyrsQuery): AxiosPromise<MartyrsVO[]> => {
  return request({
    url: '/cemetery/martyrs/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询名人烈士详细
 * @param id
 */
export const getMartyrs = (id: string | number): AxiosPromise<MartyrsVO> => {
  return request({
    url: '/cemetery/martyrs/' + id,
    method: 'get'
  });
};

/**
 * 新增名人烈士
 * @param data
 */
export const addMartyrs = (data: MartyrsForm) => {
  return request({
    url: '/cemetery/martyrs',
    method: 'post',
    data: data
  });
};

/**
 * 修改名人烈士
 * @param data
 */
export const updateMartyrs = (data: MartyrsForm) => {
  return request({
    url: '/cemetery/martyrs',
    method: 'put',
    data: data
  });
};

/**
 * 删除名人烈士
 * @param id
 */
export const delMartyrs = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/martyrs/' + id,
    method: 'delete'
  });
};
